package com.yiban.demo.Order.DAO;

import com.baomidou.mybatisplus.core.mapper.BaseMapper;
import com.yiban.demo.Order.Entity.OrderPO;
import org.apache.ibatis.annotations.Mapper;
import org.apache.ibatis.annotations.Select;
import org.apache.ibatis.annotations.Update;
import org.springframework.stereotype.Repository;

import java.util.List;

@Mapper
@Repository
public interface OrderMapper extends BaseMapper<OrderPO> {
    @Update("UPDATE `order` SET status = #{statusCode} WHERE order_id = #{orderId}")
    int updateStatusByOrderId(Long orderId,Integer statusCode);

    @Select("SELECT order_id FROM `order` WHERE user_id = #{userId} and status != #{statusCode}")
    List<Long> selectUserOrderIdByUserIdAndNotStatus(Integer userId,Integer statusCode);
}
